package com.browsesoft.dbtools;

import java.util.HashMap;
import java.util.Map;

/**
 * 数据库表信息
 */
public class DBTable {
	/**
	 * 表名
	 */
	private String name;

	/**
	 * 字段
	 */
	private Map fields = new HashMap();

	public DBTable(String name) {
		this.name = name;
	}

	public Map getFields() {
		return fields;
	}

	public void setFields(Map fields) {
		this.fields = fields;
	}

	/**
	 * 添加新字段
	 */
	public void addField(DBField field) {
		this.fields.put(field.getName(), field);
	}

	public void addFields(Map fields) {
		this.fields.putAll(fields);
	}

	/**
	 * 删除字段
	 */
	public void removeField(DBField field) {
		this.fields.remove(field.getName());
	}

	/**
	 * 得到字段
	 */
	public DBField getField(String name) {
		return (DBField) this.fields.get(name);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
